{include file='md/md_header.html'}

<div class="top-menu">
    <ul class="nav nav-pills">
        <li><a href="javascript:history.back(-1);">返回</a></li>
        <li><a href="{:url('index/index')}">首页</a></li>
    </ul>
</div>
<div class="content">
    <div class="panel panel-default">
        <div class="panel-heading">添加文档</div>
        <div class="panel-body">

            <form class="form-horizontal submit-ajax" role="form" action="{:url('add')}" method="post">
                <div class="form-group">
                    <label class="col-sm-1 control-label">*所属</label>
                    <div class="col-sm-11">
                        {:build_select('doc_id', widget('doc')->get(), $doc_id)}
                    </div>
                </div>
                <div class="form-group">
                    <label for="title" class="col-sm-1 control-label">*目录</label>
                    <div class="col-sm-11">
                        <input type="text" id="title" name="title" class="form-control" placeholder="请输入目录标题" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="name" class="col-sm-1 control-label">*名称</label>
                    <div class="col-sm-11">
                        <input type="text" id="name" name="name" class="form-control" placeholder="文件名称(下载用)" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <label for="editor" class="col-sm-1 control-label">*内容</label>
                    <div class="col-sm-11">
                        <div id="content-editormd">
                            <textarea style="display:none;" class="form-control" id="editor" name="markdown"></textarea>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="sort" class="col-sm-1 control-label">*排序</label>
                    <div class="col-sm-11">
                        <input type="text" id="sort" name="sort" class="form-control" placeholder="排序值(越小排越前)" value="50" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label">&nbsp;</label>
                    <div class="col-sm-11">
                        <input type="submit" id="submit" value="添加" class="btn btn-primary" />
                    </div>
                </div>
            </form>

        </div>
    </div>

</div>
{include file='md/md_footer.html'}
<script>
    $(function () {
        $('#sidebarToggle').click(function () {
            $('.sidebar').toggle();
        });
        editormd("content-editormd", {
            width   : "100%",
            height  : 400,
            watch : false,
            syncScrolling : "single",
            path    : "/static/js/editor_md/lib/",
            saveHTMLToTextarea : true, // 保存HTML到Textarea
            autoFocus : false,
            imageUpload    : true,
            imageFormats   : ["jpg", "jpeg", "gif", "png"],
            imageUploadURL : "{:url('api/editor_md_upload')}",
            toolbarIcons : function() {
                return ["h1", "h2", "h3", "bold", "italic", "|", "code-block", "link", "quote", "image", "table", "|", "list-ol", "list-ul",  "hr", "|", "preview", "watch", "fullscreen"]
            },
        });
    });
</script>
</body>
</html>